package com.carlinfo.stu_ques.question.service.impl;

import java.util.List;
import java.util.Map;

import com.carlinfo.stu_ques.question.dao.IAnswerDao;
import com.carlinfo.stu_ques.question.dao.IQuestionDao;
import com.carlinfo.stu_ques.question.dao.impl.AnswerDaoImpl;
import com.carlinfo.stu_ques.question.dao.impl.QuestionDaoImpl;
import com.carlinfo.stu_ques.question.pojo.Answer;
import com.carlinfo.stu_ques.question.pojo.Question;
import com.carlinfo.stu_ques.question.service.IDemoService;

public class DemoServiceImpl implements IDemoService
{
	private IAnswerDao answer = new AnswerDaoImpl();
	private IQuestionDao question = new QuestionDaoImpl();
	@Override
	public int saveOneAnswerService(Answer answer)
	{
		int id = this.answer.saveOneDao(answer);
		return id;
	}

	@Override
	public void updateOneAnswerService(Answer answer)
	{
		this.answer.updateOneDao(answer);
		
	}

	@Override
	public void deleteOneAnswerService(Answer answer)
	{
		this.answer.deleteOneDao(answer);
		
	}

	@Override
	public List<Answer> selectListAnswerService()
	{
		return this.answer.selectListDao();
	}

	@Override
	public Answer selectOneAnswerService(Map<String, Object> condMap)
	{
		return this.answer.selectOneDao(condMap);
	}

	@Override
	public String printTitleAnswerService()
	{
		String result  =  "id\t学生id\t答案\t对错\t\t\t创建时间\t\t\t结束时间";
		return result;
	}
	

	@Override
	public int saveOneQuestionService(Question Question)
	{
		int id = this.question.saveOneDao(Question);
		return id;
	}

	@Override
	public void updateOneQuestionService(Question Question)
	{
		 this.question.updateOneDao(Question);
		
	}

	@Override
	public void deleteOneQuestionService(Question Question)
	{
		this.question.deleteOneDao(Question);
		
	}

	@Override
	public List<Question> selectListQuestionService()
	{
		return this.question.selectListDao();
	}

	@Override
	public Question selectOneQuestionService(Map<String, Object> condMap)
	{
		return this.question.selectOneDao(condMap);
	}

	@Override
	public String printTitleQuestionService()
	{
		String result = "id\t名字\t分数\t回答人数\t\t\t创建时间\t\t\t结束时间";
		return result;
	}

}
